<template>
  <el-config-provider :locale="lang">
    <router-view></router-view>
  </el-config-provider>
</template>

<script setup lang="ts">
import {computed, ref, watch} from 'vue'
import {storeToRefs} from "pinia";
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import en from 'element-plus/dist/locale/en.mjs'
import Layout from "@/layout/Index.vue"
import {useHeader} from "@/store/modules/header";

const store = useHeader()
const refStore = storeToRefs(store)
const lang = ref()
const language = refStore.language

// 监听store中的language值状态变化
// watch(
//     () => language.value,
//     () => {
//       const locale = computed(() => language.value === 'zh-cn' ? zhCn : en)
//       lang.value = locale.value.name
//       console.log("watch监听language", locale.value.name)
//     }
// )

</script>

<style lang="less" scoped></style>
